package com.tueye.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.tueye.base.util.BaseDao;
import com.tueye.base.util.IBaseHbnDao;
import com.tueye.base.util.Page;
import com.tueye.dao.IAdsiteDao;
import com.tueye.entity.Admin;
import com.tueye.entity.Adsite;
/**
 * 
 * @author hanxiaowei
 *
 */
@Scope("prototype")
@Component("adsiteDao")
public class AdsiteDaoImpl extends BaseDao implements IAdsiteDao{
	
	@Autowired
	@Qualifier("baseHbnDao")
	private IBaseHbnDao  baseHbnDao;

	@Override
	public Page pagedQueryByHQL(String hql, int pageNo, int pageSize,
			Object... values) {
		return baseHbnDao.pagedQueryByHQL(hql, pageNo, pageSize, values);
	}
	@Override
	public void addAdsite(Adsite adsite){
		baseHbnDao.saveOrUpdate(adsite);
		
	}

	@Override
	public void delAdsite(String id) {
		Adsite adsite =  (Adsite) baseHbnDao.findById(Adsite.class, id);
		baseHbnDao.delete(adsite);
	}

	@Override
	public Adsite getAdsiteById(String id) {
		return (Adsite) baseHbnDao.findById(Adsite.class, id);
	}
	@Override
	public List<Adsite> getAdsiteByHql(String hql) {
		return baseHbnDao.queryList(hql);
	}
	

}
